<!DOCTYPE html>
<html>
<head>
<title>天地不仁以万物为刍狗</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<#include "/common/lib/layui-lib.html"/>
<link href="/css/style.css" rel='stylesheet' type='text/css' />
<style>
.userstyle {
	font-family: "华文彩云";
}
</style>
</head>
<body>
	<!--SIGN UP-->
	<h1>柠檬登陆</h1>
	<div class="login-form">
		<div class="close"></div>
		<div class="head-info">
			<label class="lbl-1"> </label> <label class="lbl-2"> </label> <label
				class="lbl-3"> </label>
		</div>
		<div class="clear"></div>
		<div class="avtar">
			<img src="/images/avtar.png" />
		</div>
		<form id="loginform" action="javascript:;" method="post">
			<input type="text" name="username" class="text" value="用户名"
				onfocus="this.value = '';"
				onblur="if (this.value == '') {this.value = '用户名';}"
				class="userstyle">
			<div class="key">
				<input type="password" name="passwd" value=""
					onfocus="this.value = '';"
					onblur="if (this.value == '') {this.value = '';}">
			</div>
			<div class="signin">
				<input type="button" value="登陆">
			</div>
		</form>

	</div>
	<div class="copy-rights">
		<p>
			Copyright &copy; 2017.lemon All rights reserved. <a
				href="http://jlcon.cn" target="_blank" title="柠檬之家">jlcon.cn</a> -
			Collect from <a href="http://www.cssmoban.com/" title="��ҳģ��"
				target="_blank">柠檬</a>
		</p>
	</div>
</body>
<script src="/js/jqueryui/jquery-3.2.1.min.js"></script>
<script src="/js/jqueryui/jquery.base64.js"></script>
<script type="text/javascript">
	//https://github.com/yckart/jquery.base64.js/blob/master/README.md
	$.base64.utf8encode = true;
	addEventListener("load", function() {
		setTimeout(hideURLbar, 0);
	}, false);
	function hideURLbar() {
		window.scrollTo(0, 1);
	}
	$(document).ready(function(c) {
		$('.close').on('click', function(c) {
			$('.login-form').fadeOut('slow', function(c) {
				$('.login-form').remove();
			});
		});
	});
	layui.use(['layer'], function() {
		$('input[type="button"]').click(function() {
			var jiami = $.base64.btoa($('input[type="password"]').val());
			$('input[type="password"]').val(jiami);
			$.ajax({
			    type: 'POST',
			    url: '/login.json',
			    data: $('#loginform').serialize(),
			    success: function (data) {
			    	if(data.success){
			    		layer.msg('用户验证成功，正在登录请稍后...');
			    		window.location.href = data.message;
			    	} else {
			    		layer.msg(data.message,{icon: 5,anim: 6,time: 2000});
			    	}
			    },
			    error: function(data) {
					alert("error:"+data.responseText);
				},
			    dataType: "json"
			})
			$('input[type="password"]').val('');
		})
	});
</script>
</html>